<template>
  <div>
    <li>
      <span v-if="chuxian"> 您的手机号{{ this.$store.state.zhanghao }} </span>
      <span v-if="chuxian"> 您的密码是{{ this.$store.state.mima }} </span>
    </li>
    <h5 v-if="chuxian2">{{ sanmiao }}</h5>
  </div>
</template>
<script>
export default {
  data() {
    return {
      chuxian: true,
      sanmiao: "由于你没输入账号密码 3秒后返回登录页面",
      chuxian2: false,
    };
  },
  // beforeRouterEnter(to, from, next) {
  //   if (localStorage.getItem("userTel")) {
  //     next();
  //   } else {
  //     next("/homeWork6");
  //   }
  // },
  mounted() {
    if (this.$store.state.mima == "" && this.$store.state.zhanghao == "") {
      this.chuxian2 = true;
      this.chuxian = false;
      var n = 1;
      setTimeout(() => {
        n--;
        console.log(n);
        if (n == 0) {
          this.$router.push({ path: "/homeWork6" });
        }
      }, 3000);
    }
  },
};
</script>
<style scoped>
* {
  margin: 0;
  padding: 0;
}

ul,
li {
  list-style: none;
}
a {
  text-decoration: none;
}
</style>